package db_manager;


import org.hibernate.Session;

import db_manager.Dir;

/**
 * this class is the manages the connection between the table dirs and the class Dir
 */
public class DirManager 
{
	private Session session = null;

	/**
	 * this is this class constructor
	 * @param session - the session that will be used for connection with the DB
	 */
	public DirManager(Session session) 
	{
		if(session == null)
		{
			throw new RuntimeException("Invalid session object.");
		}
		this.session = session;
	}

	/**
	 * this function add another topple to the DB
	 * @param dir - the new topple to add
	 */
	public void saveDir(Dir dir)
	{
		session.save(dir);
	}

	/**
	 * this function delete a topple from the DB
	 * @param dir - the topple to delete
	 */
	public void deleteDir(Dir dir) 
	{
		session.delete(dir);
	}
	
}